package com.ly.common.running.exception;

import com.ly.common.running.config.Context;
import com.ly.common.running.model.Result;

import java.util.ArrayList;
import java.util.List;

public class BusinessException extends RuntimeException{
    List<Result> resultList = new ArrayList<>();

    public BusinessException(String code,Object... errorMessageParams){
        super(code+":"+ExceptionCode.getErrorMessage(code,errorMessageParams));
        Result result = new Result(code,ExceptionCode.getErrorMessage(code,errorMessageParams));
        resultList.add(result);
        Context.get().getSysHead().setResultList(resultList);
        Context.get().getSysHead().setRetStatus("F");
    }
}
